<?php
/**
 * 后台首页控制器
 * UserModel: LLw
 * Data: 2020-1-7
 * Tiem: 9:55
 */
namespace app\caidongweb\controller;

use app\caidongweb\model\UserModel;

class Index extends BaseController
{
    public function index()
    {
        $title = tpConfig('Title');
        $this->assign('title',$title);
        $this->view->engine->layout('include/include');
        return view();
    }
    public function welcome(){
        $week = date('w',time());
        $us = [];
        $av = [];
        $ac = [];
        for ($i=0;$i<=6;$i++){
            $atime = strtotime(date('Y-m-d 00:00:00',strtotime( '+'. $i+1-$week .' days',time())));
            $btime = strtotime(date('Y-m-d 23:59:59',strtotime( '+'. $i+1-$week .' days',time())));

        }
    }

    public function updateStatus(){
        $table = input('table');//所要修改的表
        $id = input('id');//主键
        $where = input('where');//条件值
        $field = input('field');//修改的字段
        $state = input('state');//值
        $updata = db($table)->where([$id=>$where])->update([$field=>$state]);
        if($updata){
            return array('code'=>1,'msg'=>'成功');
        }else{
            return array('code'=>-1,'msg'=>'失败');
        }
    }
}

